import { useAPIUtils } from "@/components/APIUtilsProvider";

export function useDeliveryVendorQuery(vendorId) {
  const { tanstackQuery } = useAPIUtils();
  const dictQuery = tanstackQuery(`/api/dictionaries/deliveryVendors`);
  if (!dictQuery.data) {
    return { text: "", vendorId, format: "" }; //空对象
  } else {
    const item = dictQuery.data[vendorId];
    return { text: item?.text, vendorId, format: item?.addition.format };
  }
}
